<template>
	<view class="page-view">
		<nav-view :defaultShow="true" :backShow="false" ></nav-view>
		<view class="page-conte">
			<view class="user-view-box is-flex">
				<img class="header" :src="userInfo.avatarUrl" alt="" @click="touchToInfo">
				<view class="user-info-box">
					<view class="name-box is-flex">
						<text>{{userInfo.nickName}}</text>
						<i class="iconfont icon-jinruliuyan-01" @click="touchToInfo"></i>
					</view>
					<view class="info-box is-flex">
						<text class="phone">{{userInfo.mobile}}</text>
						
						<view class="rz-box is-flex" v-if="userInfo.is_auth == 0">
							<i class="t-icon t-icon-wode-weirenzheng-01"></i>
							<text>未认证</text>
						</view>
						<view class="rz-box rz-box2 is-flex" v-if="userInfo.is_auth == 1">
							<i class="t-icon t-icon-wode-yirenzheng-01"></i>
							<text>审核中</text>
						</view>
						<view class="rz-box rz-box2 is-flex" v-if="userInfo.is_auth == 2">
							<i class="t-icon t-icon-wode-yirenzheng-01"></i>
							<text>个人认证</text>
						</view>
					</view>
				</view>
			</view>
			<view class="mine-conte-box">
				<view class="mine-row-box is-flex">
					<view class="mine-item" v-for="(item,index) in list" :key="index" @click="touchToNext(item)">
						<view class="item-box">
							<img class="icon" :src="item.icon" alt="">
							<text class="name">{{item.name}}</text>
						</view>
						
					</view>
				</view>
			</view>
		</view>
		<tabbar :pagePath="'pages/mine/index'"></tabbar>
	</view>
</template>

<script>
	import tabbar from '../component/tabbar/tabbar.vue'
	export default{
		components:{tabbar},
		data(){
			return {
				list:[
					{name:'我的咨询',icon:require("@/static/images/icon-me-01.png"),path:'/pages/mine/consultation'},
					{name:'知识收藏',icon:require("@/static/images/icon-me-02.png"),path:'/pages/mine/knowledge'},
					{name:'关于我们',icon:require("@/static/images/icon-me-03.png"),path:'/pages/mine/about'},
					{name:'个人认证',icon:require("@/static/images/icon-me-04.png"),path:'/pages/mine/certification'},
					{name:'企业认证',icon:require("@/static/images/icon-me-05.png"),path:'/pages/mine/enterpriseCertification'}
				],
				userInfo:{}
			}
		},
		onShow() {
			/*获取个人中心数据*/
			this.getData();
		},
		methods:{
			/*获取数据*/
			getData() {
				let self = this;
				self.isloadding = true;
				self._get('user.index/detail', {}, function(res) {
					if (res.data.getPhone) {
						self.gotoPage('/pages/login/login');
						return;
					}
					self.userInfo = res.data.userInfo;
					self.setting = res.data.setting;
					self.loadding = false;
					uni.stopPullDownRefresh();
					self.isloadding = false;
				});
			},
			touchToNext(item){
				if(item.path){
					uni.navigateTo({
						url:item.path
					})
				}
			},
			touchToInfo(){
				uni.navigateTo({
					url:'/pages/mine/info'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page-conte {
		padding: 20rpx 0;
	}
	.user-view-box {
		padding: 0 40rpx;
	}
	.user-view-box .header {
		width: 166rpx;
		height: 166rpx;
		margin-right: 24rpx;
		border-radius: 100%;
		overflow: hidden;
	}
	.user-info-box {
		flex: 1;
	}
	.name-box {
		font-size: 48rpx;
		font-family: Source Han Sans CN-Bold, Source Han Sans CN;
		font-weight: bold;
		color: #001353;
	}
	.name-box .iconfont {
		font-size: 50rpx;
	}
	.info-box {
		margin-top: 10rpx;
		justify-content: flex-start;
	}
	.info-box .phone {
		font-size: 27rpx;
		font-family: Source Han Sans CN-Regular, Source Han Sans CN;
		color: #666666;
	}
	.rz-box {
		line-height: 40rpx;
		background: #F0F0F0;
		border-radius: 7rpx;
		opacity: 1;
		border: 1rpx solid #999999;
		padding: 0 15rpx;
		font-size: 24rpx;
		font-family: Source Han Sans CN-Regular, Source Han Sans CN;
		color: #999999;
	}
	.rz-box2 {
		border-color: #DF6919;
		background: #FFF1DF;
		color: #DF6919;
	}
	.mine-row-box {
		margin-top: 20rpx;
		flex-wrap: wrap;
		white-space: nowrap;
		justify-content: flex-start;
	}
	.mine-item {
		width: 33.333333%;
		text-align: center;
		padding: 40rpx;
		position: relative;
		// border-bottom: 1rpx solid rgba(112, 112, 112, 0.2);
	}
	.mine-item::after {
		display: none;
		content: '';
		position: absolute;
		right: 0;
		top: 50%;
		transform: translateY(-50%);
		width: 2rpx;
		height: 167rpx;
		background-color:rgba(112, 112, 112, 0.2);
	}
	.mine-row-box .mine-item:nth-child(3n)::after{
		display: none;
	}
	.mine-row-box .mine-item:last-child::after {
		display: none;
	}
	.item-box {
		width: 167rpx;
		height: 167rpx;
		background: linear-gradient(180deg, rgba(255,255,255,0.64) 0%, #FFFFFF 100%);
		box-shadow: 0rpx 4rpx 8rpx 1rpx rgba(16,16,16,0.16);
		border-radius: 13rpx;
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
		
	}
	
	.item-box .icon {
		width: 113rpx;
		height: 85rpx;
	}
	.item-box .name {
		margin-top: 10rpx;
		display: block;
		font-size: 27rpx;
		font-family: Source Han Sans CN-Regular, Source Han Sans CN;
		color: #333333;
	}
	
</style>